package base;

import java.util.LinkedList;

public abstract class LoadBalancer
{
	public LinkedList<Element>	list;

	public LoadBalancer()
	{
		list = new LinkedList<Element>();
	}

	public LinkedList<Element> getList()
	{
		return list;
	}

	/**
	 * Increment +1 to time on all Element in this loadbalancer.
	 */
	public void incElementTime()
	{
		for (Element el : list)
		{
			el.setTimeLoadBalancer(el.time_load_balancer + 1);
		}
	}

	/**
	 * Check if this loadbalancer list is empty.
	 * 
	 * @return false if not empty.
	 */
	public boolean isEmpty()
	{
		return list.isEmpty();
	}

	/**
	 * Load an Element from source.
	 * 
	 * @param el the Element to load.
	 */
	public abstract void load(Element el);

	/**
	 * Send an Element in the Servers, depending on algorthims implemented.
	 * 
	 * @param servers the servers.
	 * @return TODO
	 */
	public abstract Server send(Servers servers);

	/**
	 * Sort this list.
	 */
	public abstract void sort();
}
